import React from 'react'
import { View, Text } from '@tarojs/components'
import { date } from '@pier88health/p8h-common'
import CommentScore from './CommentScore'
import './CommentCard.scss'

export default function CommentCard({ data = {} }) {
  const {
    Score, CreatorName, CreatedDate, Comment
  } = data
  return (
    <View className="commentCard">
      <View className="comment-header">
        <Text className="comment-name">{CreatorName}</Text>
        <CommentScore score={Score} />
      </View>
      <View className="comment-text-container">
        <Text className="comment-text">{Comment}</Text>
      </View>
      <Text className="comment-time">{date.dateFormat(CreatedDate, 'yyyy-MM-dd hh:mm')}</Text>
    </View>
  )
}
